/*<summary>
Created By : Preeti
Created On : 10/18/2008
Class Name : Consultant_LoadMapper
Used In    : 
------------------------------------------------------------------------
Modification Log  
------------------------------------------------------------------------
Created By        Modified By         Remarks                             
-----------       ------------        ----------------------------------
                                                                          
------------------------------------------------------------------------
</summary>*/


using System.Xml;
using System.Data;
using System;
using Utils;
using System.Data.SqlClient;

namespace AdminController
{

    public class Consultant_DataLoader
    {
        public Consultant Get_Consultant_DATA(string ConsultantID)
        {
            Consultant objConsultant = new Consultant();
            ezUtilsAdapter DBL = new ezUtilsAdapter();
            DataChecker dtc = new DataChecker();
            DataSet ds = new DataSet();


            try
            {
                ds = DBL.RunSPReturnDataSet("SP_GetConsultant", "TR", new SqlParameter("@vchConsultantID", ConsultantID));
                if (ds.Tables[0].Rows.Count > 0)
                {
                    DataRow dr = ds.Tables[0].Rows[0];
                    objConsultant.LastName = Convert.ToString(dr["LastName"]);
                    objConsultant.FirstName = Convert.ToString(dr["FirstName"]);
                    objConsultant.FullName = Convert.ToString(dr["FullName"]);
                    objConsultant.Address = Convert.ToString(dr["Address"]);
                    objConsultant.City = Convert.ToString(dr["City"]);
                    objConsultant.State = Convert.ToString(dr["State"]);
                    objConsultant.ZipCode = Convert.ToString(dr["ZipCode"]);
                    objConsultant.MobilePhone = Convert.ToString(dr["MobilePhone"]);
                    objConsultant.OfficePhone = Convert.ToString(dr["OfficePhone"]);
                    objConsultant.HomePhone = Convert.ToString(dr["HomePhone"]);
                    objConsultant.EmailAddress = Convert.ToString(dr["EmailAddress"]);
                    objConsultant.EmergencyContactName = Convert.ToString(dr["EmergencyContactName"]);
                    objConsultant.EmergencyContactPhone = Convert.ToString(dr["EmergencyContactPhone"]);
                    objConsultant.Specialization = Convert.ToString(dr["Specialization"]);
                    objConsultant.Remarks = Convert.ToString(dr["Remarks"]);
                    objConsultant.Fees = Convert.ToDouble(dr["Fees"]);
                    return objConsultant;
                }
                else
                {
                    return objConsultant;
                }
            }
            catch (SqlException ex)
            {
                string errorMessage = String.Format(
                    "An Error Occurred While Loading the Consultant Information to the DB. Message: {0}", ex.Message);
                return objConsultant;
            }
            finally
            {
                DBL.Dispose();
                dtc.Dispose();
                ds.Dispose();

            }
        }

        public void Dispose()
        {
            this.Dispose(true);
            System.GC.SuppressFinalize(this);
        }

        private void Dispose(bool disposing)
        {
        }


    }
}